﻿using LeadThing.AbpZeroTemplate.Authorization.Users;
using LeadThing.AbpZeroTemplate.Authorization.Users.Dto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Text;
using System.Threading.Tasks;

namespace LeadThing.AbpZeroTemplate.Web.Controllers
{
    public class HuanXinController : Controller
    {
        /// <summary>
        /// 设置app的基本信息
        /// </summary>
        string appName = "juxiantong",
            orgName = "1138171114178616",
            clientID = "YXA6utPisMmjEee2sD23EZ8eDQ",
            clientSecret = "YXA6wzbcGU7w1vJAzs7Z09rEgmVKfnY";

        private readonly IUserAppService _userAppService;

        public HuanXinController(IUserAppService userAppService)
        {
            _userAppService = userAppService;
        }


        // GET: HuanXin
        [AsyncTimeout(1000)]
        public async Task<ActionResult> Index()
        {
            StringBuilder json = new StringBuilder();
            HXComm.EaseMobDemo easeMob = new HXComm.EaseMobDemo();

            GetUsersInput input = new GetUsersInput() { };
            var userList = await _userAppService.GetAllUsersByWhere(input);

            foreach (var item in userList.Items)
            {
                json.Append(easeMob.AccountCreate(item.Id.ToString(), "123456"));
            }

            ViewBag.ResponseContent = json.ToString();

            return View();
        }
    }
}